<?php use_helper('PA_Links') ?>
<?php if($handler): ?>
<script type="text/javascript">
  $(window).unload(function(){
    <?php echo "opener.App.Table.$handler()";?>
  });
  
<?php endif;  ?>
</script>
<div class="sComponentContainer">
  <div class="sComponent floatLeft">
    <p id="title">Role użytkowników</p>
    <table id="rolesTable">
      <th>Lp.</th>
      <th>Nazwa</th>
      <th>Admin</th>
      <th>Edycja</th>
      <?php if($roles): ?>
      <?php foreach($roles as $role): ?>
      <tr>
        <td><p id="counter"></p></td>
        <td><?php echo $role->getName() ?></td>
        <td><?php echo $role->getIsAdmin() ? "TAK" : "NIE" ?></td>
        <td nowrap="nowrap">
          <img src="/images/icons/change.png" class="middle" width="18" height="18"/>  <a onclick="App.Table.attachForm(this, '<?php echo link_to_app('Core', 'homeGetForm', array('form' => 'RoleForm', 'form_action' => 'update', 'id' => $role->getId())) ?>', '#rolesTable', 'updateRole', 2, 2, true)" class="middle">Zmień</a>
          <img src="/images/icons/delete.png" class="middle" width="18" height="18"/>  <a href="<?php echo link_to_app('Core', 'deleteRole', array('id' => $role->getId())) ?>" class="middle">Usuń</a>
        </td>
      </tr>
      <?php endforeach; ?>
      <?php endif; ?>
      <tr id="add">
        <td colspan="5"><img src="/images/icons/add.png" class="middle" width="18" height="18"/>  <a onclick="App.Table.attachForm(this, '<?php echo link_to_app('Core', 'homeGetForm', array('form' => 'RoleForm', 'form_action' => 'create')) ?>', '#rolesTable', 'createRole', 2, 2, true)" class="middle">Dodaj</a></td>
      </tr>
    </table>
  </div>
</div>
